﻿package cn.poco.pepsi.service.impl;

import java.io.InputStream;
import java.util.ArrayList;

import android.util.Log;
import cn.poco.pepsi.bean.Restaurant;
import cn.poco.pepsi.bean.Topic;
import cn.poco.pepsi.service.ITopic;
import cn.poco.pepsi.util.UrlConnectionUtil;
import cn.poco.pepsi.util.UrlMatchUtil;
import cn.poco.pepsi.util.xmlpared.TopicXmlparse;


public class TopicImpl implements ITopic {

	private final static String TAG = "impl";

	@Override
	public ArrayList<Topic> getTopics(String s, String l, String cd) throws Exception {

       String url=BASE_TOPICS_PATH.replace("#s", s).replace("#l", l).replace("#cd", cd);		
		InputStream inStream = null;
		Log.i(TAG, url);
		inStream = UrlConnectionUtil.getRequest(url);
		return TopicXmlparse.getXml(inStream);

	}

	/*
	 * @Override public Topic getTopic(String tid) throws Exception {
	 * InputStream inStream = null; String url =
	 * TOPICS_DETAIL_PATH.replace("#a", tid); inStream =
	 * UrlConnectionUtil.getRequest(url); return
	 * TopicXmlparse.getXml(inStream).get(0); }
	 */
/*
	@Override
	public ArrayList<Restaurant> getResByTid(String tid, int s, int l) throws Exception {
		InputStream inStream = null;
		String path = RES_TID_PATH.replace("#a", tid).replace("#b", String.valueOf(s)).replace("#c", String.valueOf(l));
		path = UrlMatchUtil.matchUrl(path);
		Log.i(TAG, path);
		inStream = UrlConnectionUtil.getRequest(path);
		return RestaurantXmlparse.getXml(inStream);

	}*/

}
